2 ==============================================================================
4 This file is part of the JUCE library - "Jules' Utility Class Extensions"
5 Copyright 2004-11 by Raw Material Software Ltd.
7 ------------------------------------------------------------------------------
9 JUCE can be redistributed and/or modified under the terms of the GNU General
10 Public License (Version 2), as published by the Free Software Foundation.
11 A copy of the license is included in the JUCE distribution, or can be found
12 online at www.gnu.org/licenses.
14 JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
15 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
16 A PARTICULAR PURPOSE. See the GNU General Public License for more details.
18 ------------------------------------------------------------------------------
20 To release a closed-source product which uses JUCE, commercial licenses are
21 available: visit www.rawmaterialsoftware.com/juce for more information.
23 ==============================================================================
26 #ifndef __JUCER_BINARYRESOURCES_JUCEHEADER__
27 #define __JUCER_BINARYRESOURCES_JUCEHEADER__
32 //==============================================================================
34 Manages a list of binary data objects that a JucerDocument wants to embed in
35 the code it generates.
40 //==============================================================================
44 BinaryResources
& operator= (const BinaryResources
& other
);
46 void loadFromCpp (const File
& cppFileLocation
, const String
& cpp
);
48 //==============================================================================
55 String originalFilename
;
61 bool add (const String
& name
, const File
& file
);
62 void add (const String
& name
, const String
& originalFileName
, const MemoryBlock
& data
);
63 void remove (const int index
);
64 bool reload (const int index
);
65 const String
browseForResource (const String
& title
, const String
& wildcard
,
66 const File
& fileToStartFrom
, const String
& resourceToReplace
);
68 const String
findUniqueName (const String
& rootName
) const;
70 int size() const throw() { return resources
.size(); }
71 const BinaryResource
* operator[] (const int index
) const throw() { return resources
[index
]; }
73 const BinaryResource
* getResource (const String
& resourceName
) const;
74 const BinaryResource
* getResourceForFile (const File
& file
) const;
76 const StringArray
getResourceNames() const;
78 const Drawable
* getDrawable (const String
& name
) const;
79 const Image
getImageFromCache (const String
& name
) const;
81 template <class ElementComparator
>
82 void sort (ElementComparator
& sorter
)
84 resources
.sort (sorter
, true);
88 //==============================================================================
89 void setDocument (JucerDocument
* const document_
) { document
= document_
; }
90 JucerDocument
* getDocument() const throw() { return document
; }
92 void fillInGeneratedCode (GeneratedCode
& code
) const;
96 //==============================================================================
97 JucerDocument
* document
;
98 OwnedArray
<BinaryResource
> resources
;
100 BinaryResource
* findResource (const String
& name
) const throw();
105 #endif // __JUCER_BINARYRESOURCES_JUCEHEADER__